<template>
	<el-dialog
		title="系统指南"
		:visible.sync="comIsShow"
		width="80%"
		:before-close="cancel"
		modal-append-to-body
		append-to-body
		:close-on-click-modal="false"
		:close-on-press-escape="false"
		top="5vh"
	>
		<div id="ProductInfoGuide">
			<div class="GuideLeft">
				<!-- <div
					class="versionActive"
					:class="contentKey === index ? 'activeya' : ''"
					v-for="(item, index) in guideData"
					:key="index"
					@click="contentKey = index"
				>
					{{ item.version }}
				</div> -->
				<el-tree
					node-key="id"
					:default-checked-keys="[1]"
					:data="guideData"
					accordion
					:props="defaultProps"
					@node-click="handleNodeClick"
					highlight-current
					:check-strictly="true"
				></el-tree>
			</div>
			<div class="GuideRight" v-html="moduleContent"></div>
		</div>
		<span slot="footer" class="dialog-footer">
			<el-button @click="cancel" size="small" type="primary">关 闭</el-button>
		</span>
	</el-dialog>
</template>
<script>
	import { guideData } from './data'
	export default {
		props: {
			comIsShow: {
				type: Boolean,
				default: false
			},
			comIsShowFunc: {
				type: Function,
				default: Function
			}
		},

		data() {
			return {
				guideData,
				contentKey: 0,
				defaultProps: {
					children: 'children',
					label: 'label'
				},
				moduleContent: ''
			}
		},

		mounted() {
			this.handleNodeClick()
		},

		methods: {
			cancel() {
				this.contentKey = 0
				this.$emit('comIsShowFunc')
			},

			handleNodeClick(data) {
				if (data) {
					this.moduleContent = data.content
				} else {
					this.moduleContent = this.guideData[0].content
				}
			}
		}
	}
</script>
<style lang="scss" scoped >
	#ProductInfoGuide {
		border: 1px solid #dcdfe6;
		height: 650px;
		display: flex;
		.GuideLeft {
			width: 20%;
			border-right: 1px solid #dcdfe6;
			height: 650px;
			padding: 20px;
			overflow: auto;
		}
		.GuideRight {
			width: 80%;
			height: 650px;
			overflow: auto;
			padding: 20px;
		}
		.versionActive {
			width: 100%;
			height: 28px;
			cursor: pointer;
			font-size: 1.2em;
			font-weight: 600;
			color: #2c3e50;
			padding-left: 20px;
			display: flex;
			align-items: center;
			border-left: 4px solid white;
			overflow: hidden;
			text-overflow: ellipsis;
			word-break: keep-all;
			white-space: nowrap;
		}
		.activeya {
			color: #3eaf7c;
			border-left: 4px solid #3eaf7c;
		}
		/*修改滚动条样式*/
		.GuideLeft::-webkit-scrollbar {
			width: 8px;
			height: 8px;
			/**/
		}
		.GuideLeft::-webkit-scrollbar-track {
			background: rgb(239, 239, 239);
			border-radius: 2px;
		}
		.GuideLeft::-webkit-scrollbar-thumb {
			background: #bfbfbf;
			border-radius: 10px;
		}

		.GuideLeft::-webkit-scrollbar-corner {
			background: #179a16;
		}

		/*修改滚动条样式*/
		.GuideRight::-webkit-scrollbar {
			width: 8px;
			height: 8px;
			/**/
		}
		.GuideRight::-webkit-scrollbar-track {
			background: rgb(239, 239, 239);
			border-radius: 2px;
		}
		.GuideRight::-webkit-scrollbar-thumb {
			background: #bfbfbf;
			border-radius: 10px;
		}

		.GuideRight::-webkit-scrollbar-corner {
			background: #179a16;
		}
	}
	::v-deep .el-tree-node__label {
		width: 100%;
		height: 28px;
		cursor: pointer;
		font-size: 17px;
		display: flex;
		align-items: center;
		overflow: hidden;
		text-overflow: ellipsis;
		word-break: keep-all;
		white-space: nowrap;
	}
	::v-deep .el-tree-node__expand-icon {
		display: none;
		padding: 0;
	}

	::v-deep .el-tree-node__children * {
		font-weight: 500;
		font-size: 15px;
	}
	::v-deep .el-tree-node__content {
		font-weight: 600;
	}
	::v-deep .el-tree-node__content:hover {
		background-color: inherit;
	}
	::v-deep .el-tree-node__content:active {
		background-color: inherit;
	}
	::v-deep .el-tree-node:focus > .el-tree-node__content {
		background-color: inherit;
	}
	::v-deep .el-tree-node__label {
		border-left: none;
	}
	::v-deep .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
		color: #3eaf7c !important;
	}
</style>
// el-tree-node is-expanded is-focusable
// el-tree-node is-expanded is-current is-focusable
